// stores/postStore.ts
import { defineStore } from 'pinia'

export const usePostStore = defineStore('post', {
  state: () => ({
    postList: [] as PostItem[],
    total: 0
  }),
  actions: {
    setPostList(data: PostItem[], total: number) {
      this.postList = data
      this.total = total
    },
    resetPostList() {
      this.postList = []
      this.total = 0
    }
  }
})

// 类型定义（你也可以放在 types.ts）
export interface PostItem {
  id: number
  userId: number
  teamId: number
  title: string
  content: string
  coverImage: string
  tagIds: string
  status: number
  viewCount: number
  likeCount: number
  commentCount: number
  shareCount: number
  isTop: number
  publishTime: string
  isEssence: number
  createTime: string
  updateTime: string
  deleted: number
  username: string
  avatar: string
}
